package zzs.generalframework.gui.server.core.login;

import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import org.eclipse.wb.swing.FocusTraversalOnArray;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * @title
 * @description
 * @project zzs-gui
 * @package zzs.generalframework.gui.server.core.login
 * @author zzs
 * @date 2018年3月29日
 * @version 1.0
 */
public class LoginPanel extends JPanel
{
	/**
	 * 
	 */
	private static final long serialVersionUID = -6457533180032181882L;
	/**
	 * 
	 */
	private JTextField login_text_userName;
	private JPasswordField login_pwd_password;

	/**
	 * Create the panel.
	 */
	public LoginPanel()
	{
		setLayout(null);

		JLabel login_lbl_用户名 = new JLabel("用户名:");
		login_lbl_用户名.setBounds(186, 122, 54, 15);
		add(login_lbl_用户名);

		login_text_userName = new JTextField();
		login_text_userName.setBounds(309, 119, 180, 21);
		add(login_text_userName);
		login_text_userName.setColumns(10);

		JLabel login_lbl_密码 = new JLabel("密码:");
		login_lbl_密码.setBounds(186, 199, 54, 15);
		add(login_lbl_密码);

		login_pwd_password = new JPasswordField();
		login_pwd_password.setBounds(309, 196, 180, 21);
		add(login_pwd_password);

		JButton login_btn_提交 = new JButton("提交");
		login_btn_提交.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				String userName = login_text_userName.getText();
				String password = new String(login_pwd_password.getPassword());
				JOptionPane.showMessageDialog(null, "提交用户名:" + userName + ",密码:" + password);
			}
		});
		login_btn_提交.setBounds(186, 292, 93, 23);
		add(login_btn_提交);

		JButton login_btn_重置 = new JButton("重置");
		login_btn_重置.setBounds(396, 292, 93, 23);
		add(login_btn_重置);
		setFocusTraversalPolicy(new FocusTraversalOnArray(new Component[]
		{ login_text_userName, login_pwd_password, login_btn_提交, login_btn_重置 }));
	}

}
